import { Coordinate, Notebook, User } from '@element-plus/icons-vue'

import { shallowRef } from 'vue'
import { createRouter, createWebHistory } from 'vue-router';

const layoutMain = () => import('@/layout/mainWindows.vue')
const layoutSub = () => import('@/layout/subWindows.vue')

const router = createRouter({
  history: createWebHistory(),
  routes: [
    // 主窗口
    {
      path: '/',
      name: 'main',
      component: layoutMain,
      redirect: '/personal',
      children: [
        {
          path: '/personal',
          name: 'personal',
          meta: { title: '个人信息', icon: shallowRef(User) },
          component: () => import('@/views/personal/index.vue'),
        },
        {
          path: '/history',
          name: 'history',
          meta: { title: '历史战绩', icon: shallowRef(Notebook) },
          component: () => import('@/views/history/index.vue'),
        },
        {
          path: '/matchAssistant',
          name: 'matchAssistant',
          meta: { title: '对局助手', icon: shallowRef(Coordinate) },
          component: () => import('@/views/matchAssistant/index.vue'),
        },

      ],
    },
    // 子窗口
    {
      path: '/sub',
      name: 'sub',
      component: layoutSub,
      children: [
        {
          path: 'otherPlayer',
          name: 'otherPlayer',
          meta: { title: '玩家信息' },
          component: () => import('@/views/otherPlayer/index.vue'),
        },
        {
          path: 'historyDetail',
          name: 'historyDetail',
          meta: { title: '历史战绩详情' },
          component: () => import('@/views/historyDetail/index.vue'),
        },
      ],
    },
  ],
});

export default router;
